<?php

namespace App\Models\SystemManagement;

use App\Models\CommonModel;
use App\Models\Constant\Fields;
use App\Models\Garbage\GarbagePoint;

class Manager extends CommonModel
{
    protected $table = 'managers';
    public $primaryKey = 'id';

    protected $hidden = ['deleted_at','created_at','updated_at'];

    /**
     * @param $data
     * @return string
     * 添加用户数据
     */
    public static function addData($data){
        $param = new self();
        $param->create($data);
        return $param;
    }

    /**
     * @return mixed
     * 获取用户数据
     */
    public static function getPageData($per){
        $query = self::paginate($per);
        return $query;
    }

    /**
     * @param $id
     * @return mixed
     * 获取单条用户数据
     */
    public static function getOne($id){
        $query = self::find($id);
        return $query;
    }

    /**
     * @param $name
     * @return mixed
     * 通过条件查找
     */
    public static function getByCondition($con){
        $query = self::getTableDataByCondition($con,new self());
        return $query;
    }

    /**
     * @param $arr
     * @return bool
     * 修改某条数据
     */
    public static function updateData($arr,$id){
        $query = self::updateTableData($arr,$id,new self());
        return $query;
    }

    /**
     * @param $ids
     * @return \App\Models\Error
     * 删除
     */
    static function del($ids){
        $query = self::batchDelTableData($ids,new self());
        return $query;
    }

    /**
     * @param $ids
     * @return \App\Models\Error
     * 恢复
     */
    static function recover($ids){
        $query = self::batchResetTableData($ids,new self());
        return $query;
    }
}
